package com.dotflat.staffExtend.repository;

import com.dotflat.staffExtend.domain.StaffExtendInfoRank;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StaffExtendInfoRankRepository extends JpaRepository<StaffExtendInfoRank, String>, JpaSpecificationExecutor<StaffExtendInfoRank> {

    StaffExtendInfoRank findFirstByAreaIdAndRankCircleIdAndStaffId(String areaId, String circleId, String staffId);

    @Query(value = "select * from ex_staff_extend_rank r where   r.areaId = ?1  and r.rankCircleId = ?2  order by  r.rankVal desc LIMIT ?3", nativeQuery = true)
    List<StaffExtendInfoRank> findFirstByAreaIdAndRankCircleId(String areaId, String circleId,int count);

}
